package com.hc.oauthserver.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hc.oauthserver.pojo.SysUser;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<SysUser> {

    @Select("select * from user where username=#{username}")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "roles", column = "id", javaType = List.class,
                    many = @Many(select = "com.hc.oauthserver.mapper.RoleMapper.findByUid"))
    })
    SysUser findByUsername(String username);
}
